package com.sgb.kjwl.view.ui.adapter.self.logistics;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.transport.MotorcadListEntity;
import java.util.List;

/**
 * @author: 熊丽
 * @date: 2021/10/09 15:32
 * @Description: 车队列表适配器
 */
public class ProprietaryItemAdapter extends BaseQuickAdapter<MotorcadListEntity, BaseViewHolder> {

    public ProprietaryItemAdapter(@Nullable List<MotorcadListEntity> data) {
        super( R.layout.item_linked_fleet, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MotorcadListEntity item) {
        syncCommon(helper,item);
            syncProprietary(helper,item);
    }
    /**
     * 设置公用信息
     */
    private void syncCommon(BaseViewHolder helper, MotorcadListEntity item) {
        helper.setVisible(R.id.ll_item_content,true);
        helper.setText(R.id.tv_item_name,item.getMotorcadeName());
        helper.setText(R.id.tv_item_contacts_name,item.getName());
        helper.addOnClickListener(R.id.tv_item_fleet_edit);
        helper.addOnClickListener(R.id.tv_item_fleet_del);
        helper.addOnClickListener(R.id.cl_fleet_item);
    }

    /**
     * 同步
     */
    private void syncProprietary(BaseViewHolder helper, MotorcadListEntity item) {
            helper.setText(R.id.tv_item_fleet_member_number,"共"+item.getDriverCount()+"人");
            helper.setText(R.id.tv_item_fleet_car_number,"共"+item.getCarCount()+"辆");
        helper.setText(R.id.tv_item_fleet_member,"车队成员");
        helper.setText(R.id.tv_item_fleet_car,"车队车辆");
        helper.setVisible(R.id.iv_item_fleet_status,false);
        helper.setText(R.id.tv_item_fleet_edit,"编辑");
    }

}
